package org.example.factory.simple_factory;


/**
 * @Author KEKE
 * @Date 2024/7/1 9:30
 * @Description 咖啡店
 * @Version 1.0
 */
public class CoffeeStore {
    public Coffee orderCoffee(String type) {

        SimpleCoffeeFactory factory = new SimpleCoffeeFactory();
        //调用生产咖啡的方法
        Coffee coffee = factory.createCffee(type);


//        //声明coffee类型的变量，根据不同类型创建不同的coffee子类对象
//        Coffee coffee = null;
//        if("american".equals(type)){
//            coffee = new AmericanCoffee();
//        }else if("latter".equals(type)){
//            coffee = new LatterCoffee();
//        }else{
//            throw new RuntimeException("所点的咖啡没有此类型");
//        }
        //加糖，加奶
        coffee.addmilk();
        coffee.addsugar();
        return coffee;


    }
}
